package com.bsoft.ecommerce.filter;

import com.bsoft.ecommerce.vo.LoginUserInfo;

//  使用ThreadLocal 去单独存储每一个线程携带的LoginUserInfo的信息
// 及时的清理  没内存泄漏
//线程复用  不会出现数据混乱
public class AccessContext {
    private  static  final  ThreadLocal<LoginUserInfo>  loginUserInfo= new ThreadLocal<>();
    public  static  LoginUserInfo getLoginuserInfo(){
         return  loginUserInfo.get();
    }
  public static void setLoginUserInfo(LoginUserInfo loginUserInfo_){
        loginUserInfo.set(loginUserInfo_) ;
  }
  public static  void clearLogUserInfo(){
         loginUserInfo.remove();
  }
}
